from django.test import TestCase

# Create your tests here.



# 拓展
# itsdangerous加解密
from itsdangerous import TimedJSONWebSignatureSerializer

# if __name__ == '__main__':
    # data = {
    #     'name':'ks'
    # }
    # # 创建对象                                    密匙               解密有效时间
    # serializer = TimedJSONWebSignatureSerializer(secret_key='abc',expires_in=3600)
    #
    # res = serializer.dumps(data).decode()
    #
    # print(res)

    # data = 'eyJpYXQiOjE1NDQ3ODcyNjAsImFsZyI6IkhTNTEyIiwiZXhwIjoxNTQ0NzkwODYwfQ.eyJuYW1lIjoia3MifQ.mLB7eKN3Ob269FYtbI18TMhbhdhv0kJXua6DNNLqvWvnRUUMHv2Gi4xjH2agMWKR1cd5CUlb65ciGOCc_N_4CA'
    # serializer = TimedJSONWebSignatureSerializer(secret_key='abc')
    # res = serializer.loads(data)
    # print(res)

# if __name__ == '__main__':
#     from urllib.parse import parse_qs
# # 将查询字符串转换为字典
# data = 'a=1&b=2'
# print(parse_qs(data))

# from urllib.parse import urlencode
# 将字典转化为查询字符串
# data = {
#     "name":"jfjfjf"
#     ,"age":20
# }
#
# print(urlencode(data))

# from urllib.request import urlopen
# 发送http网络请求

# data = 'https://www.baidu.com/'
# urlopen1 = urlopen(data)
# print(urlopen1)
